﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/QuizAdmin.Master" AutoEventWireup="true" CodeBehind="ViewApplicants.aspx.cs" Inherits="BladeTecWebApplication.Admin.ViewApplicants" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<script type="text/javascript">
	$(function () {
		//$("#dialog:ui-dialog").dialog("destroy");
		$('#keyDialog').dialog({
			autoOpen: false,
			width: 400,
			modal: true,
			buttons: {
				"Ok": function () {
					$(this).dialog("close");
				}
			}
		});

		$('ul#icons li').hover(
			function () { $(this).addClass('ui-state-hover'); },
			function () { $(this).removeClass('ui-state-hover'); }
		);

	});

	function showKey(key) {
		$("#keyDialog").html(key);
		$('#keyDialog').dialog('open');
	}

	function confirmDelete(confirmed) {

		if (!confirmed) {
			$("#dialog-confirm").dialog({
				resizable: false,
				height: 200,
				width: 400,
				modal: true,
				buttons: {
					"Delete Applicant": function () {
						$(this).dialog("close");
						$("#MainContent_deleteButtonHidden").click();
					},
					Cancel: function () {
						$(this).dialog("close");
					}
				}
			});
			return false;
		} else {
			return true;
		}

	}

	function launchQuiz(email, quizKey) {
		//
		window.open('../Default.aspx?key=' + quizKey + '&email=' + email, 'quiz');
		return true;
	}

</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<span class="pageTitle">View Applicants</span>
<br /><br />

	<asp:GridView ID="gvApplicants" runat="server" AutoGenerateColumns="false" CssClass="netsysTable"
		AlternatingRowStyle-CssClass="netsysTableRowAlt" 
		RowStyle-CssClass="netsysTableRow" BorderStyle="None" BorderWidth="0" 
		AllowSorting="true" onsorting="gvApplicants_Sorting" Width="100%">
		<Columns>
			<asp:TemplateField>
				<ItemTemplate>
					<input type="checkbox" name="applicant_<%#Eval("APPLICANT_ID") %>" value="<%#Eval("APPLICANT_ID") %>" />
				</ItemTemplate>
			</asp:TemplateField>
			<asp:BoundField DataField="FIRST_NAME" HeaderText="First Name" SortExpression="FIRST_NAME" />
			<asp:BoundField DataField="LAST_NAME" HeaderText="Last Name" SortExpression="LAST_NAME" />
			<asp:TemplateField HeaderText="Email" SortExpression="EMAIL">
				<ItemTemplate>
					<a href="mailto:<%#Eval("EMAIL") %>"><%#Eval("EMAIL") %></a>
				</ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField HeaderText="Quiz Key">
				<ItemTemplate>
					<a href="javascript:showKey('<%#Eval("APPLICANT_KEY") %>');">Show</a>
				</ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField HeaderText="Launch Quiz">
				<ItemTemplate>
					<button onclick="javascript:launchQuiz('<%#Eval("EMAIL") %>', '<%#Eval("APPLICANT_KEY") %>');">Launch</button>
				</ItemTemplate>
			</asp:TemplateField>
			<asp:BoundField DataField="INTERVIEW_DATE" HeaderText="Interview Date" DataFormatString="{0:d}" SortExpression="INTERVIEW_DATE" />
			<asp:BoundField DataField="POSITION_TITLE" HeaderText="Position" SortExpression="POSITION_TITLE" />
			<asp:TemplateField HeaderText="">
				<ItemTemplate>
					<a href="EditApplicant.aspx?applicant_id=<%#Eval("APPLICANT_ID") %>">Edit</a>
				</ItemTemplate>
			</asp:TemplateField>
		</Columns>
	</asp:GridView>
	
	<div style="width:100%; margin-top: 10px;">
		<!--<asp:Button ID="btnCompare" runat="server" Text="Compare Selected" />-->
		<asp:Button ID="btnDelete" runat="server" Text="Delete Selected" 
			onclick="btnDelete_Click" OnClientClick="return confirmDelete(false);" 
			ClientIDMode="Predictable" />
		<div style="display:none">
			<asp:Button runat="server" OnClick="btnDelete_Click" ID="deleteButtonHidden" ClientIDMode="Predictable"/>
		</div>
	</div>

<div id="keyDialog" title="Quiz Key">
	No more than 10 answers are allowed per question.
</div>

<div id="dialog-confirm" title="Confirm Delete" style="display:none;">
	<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure you want to delete the selected applicants? All quiz results for the selected applicants will also be deleted.</p>
</div>

</asp:Content>
